from django.urls import path
from rest_framework.routers import DefaultRouter
from system.views import LoginView,UserView, \
                         RoleView,RoleMenuView, \
                         MenuView,MenuTreeView, \
                         SysConfigView, SysOperLogView

router = DefaultRouter()

# 用户管理视图，自动管理路由
# 用户视图 - 只能查看和修改自己的信息
router.register(r'user', UserView, basename='user')
# 角色管理，自动管理路由
router.register(r'role', RoleView, basename='role')
# 角色菜单分配
router.register(r'role_menu', RoleMenuView, basename='role_menu')
# 菜单管理，自动管理路由
router.register(r'menu', MenuView, basename='menu')
# 操作日志管理
router.register(r'oper_log', SysOperLogView, basename='oper_log')


urlpatterns = [
    path(r'login', LoginView.as_view(), name='login_view'), # 登录
    path(r'menu_tree', MenuTreeView.as_view(), name='men_tree'),
    path(r'config', SysConfigView.as_view(), name='config'),
]

urlpatterns += router.urls

